package name.fowler.refactoring.simplestore;

import java.util.ArrayList;
import java.util.List;

import name.fowler.refactoring.simplestore.reporter.FormaterInterface;
import name.fowler.refactoring.simplestore.reporter.TextFormater;
import name.fowler.refactoring.simplestore.reporter.Reporter;
import name.fowler.refactoring.simplestore.reporter.ReporterInterface;

public class MainClass {

	public static void main(String[] args) {

		// Create movies
        Movie movCinderella = new Movie("Cinderella", PriceCode.CHILDRENS);
        Movie movStarWars = new Movie("Star Wars", PriceCode.NEW_RELEASE);
        Movie movGladiator = new Movie("Gladiator", PriceCode.REGULAR);
        
        // Create customers
        Customer custMickeyMouse = new Customer("Mickey Mouse");
        Customer custDonaldDuck = new Customer("Donald Duck");
        Customer custMinnieMouse = new Customer("Minnie Mouse");

        //This will not be needed once we have store
        List<Customer> cList = new ArrayList<Customer>();
        cList.add(custMickeyMouse);
        cList.add(custDonaldDuck);
        cList.add(custMinnieMouse);
        
        // Create rentals
        Rental rental1 = new Rental(movCinderella, 5);
        Rental rental2 = new Rental(movStarWars, 5);
        Rental rental3 = new Rental(movGladiator, 5);

        // Assign rentals to customers
        custMickeyMouse.addRental(rental1);
        custDonaldDuck.addRental(rental2);
        custMickeyMouse.addRental(rental3);

        // Generate invoice
        FormaterInterface formater = new TextFormater();
        ReporterInterface reporter = new Reporter(formater);
        
        String statement = reporter.getCustomerDebt(custMickeyMouse);
        String statement1 = reporter.getCustomerDebt(custDonaldDuck);
        String statement2 = reporter.getCustomerDebt(custMinnieMouse);

        // Print the statement
        System.out.println(statement);
        System.out.println(statement1);
        System.out.println(statement2);
        
        // Report all debts
        String allDebts = reporter.getAllDebts(cList);
        System.out.println(allDebts);
        
        // Report debt for one rental
        String oneRental = reporter.getRentalDebt(rental1);
        System.out.println(oneRental);
	}

}
